home *** CD-ROM | disk | FTP | other *** search
/ Champak 106 / Vol 106.iso / games / i_am_leg.swf / scripts / DefineSprite_538 / frame_3 / DoAction.as
Encoding:
Text File  |  2010-04-12  |  2.6 KB  |  122 lines

  1. anzeige.text = this.energy;
  2. xwalkspeedakt = xwalkspeed + _root.speedausgleich;
  3. diffx = Math.round(this._x - _root.huntpos._x);
  4. diffy = Math.round(this._y - _root.huntpos._y);
  5. if(this.fadeit == true)
  6. {
  7.    if(this._alpha > 0 && this.fadewaiter > 30)
  8.    {
  9.       this._alpha -= 10;
  10.    }
  11.    else if(this._alpha < 0)
  12.    {
  13.       stop();
  14.       this.removeMovieClip();
  15.    }
  16.    else
  17.    {
  18.       fadewaiter += 1;
  19.    }
  20. }
  21. if(this.alive == "true")
  22. {
  23.    if(_root.playeralive == true)
  24.    {
  25.       if(random(50) < 3)
  26.       {
  27.          this.walkallowed = true;
  28.       }
  29.       else if(random(50) == 4)
  30.       {
  31.          this.walkallowed = false;
  32.          this.enemy.gotoAndStop(1);
  33.       }
  34.       if(this.walkallowed == true)
  35.       {
  36.          this.enemy.play();
  37.          if(diffx > 2)
  38.          {
  39.             this._xscale = 86;
  40.             this._x -= xwalkspeedakt;
  41.          }
  42.          else if(diffx < 0)
  43.          {
  44.             this._xscale = -86;
  45.             this._x += xwalkspeedakt;
  46.          }
  47.          if(diffy > 8)
  48.          {
  49.             this._y -= ywalkspeed;
  50.          }
  51.          else if(diffy < 5)
  52.          {
  53.             this._y += ywalkspeed;
  54.          }
  55.       }
  56.       else
  57.       {
  58.          this._x -= _root.speedausgleich;
  59.       }
  60.    }
  61. }
  62. else
  63. {
  64.    this._x -= _root.speedausgleich;
  65. }
  66. this.getroffen = false;
  67. a = _root.shotactive - 20;
  68. while(a < _root.shotactive + 1)
  69. {
  70.    if(_root["shot" + a].hitTest(this.enemy.hitbox) == true)
  71.    {
  72.       _root["shot" + a].removeMovieClip();
  73.       this.getroffen = true;
  74.    }
  75.    a++;
  76. }
  77. if(this.alive != "deathsceneplayed")
  78. {
  79.    if(_root.player.hitbox.hitTest(this.enemy.hitbox) == true)
  80.    {
  81.       if(_root.playeralive == true && this.att_act == false)
  82.       {
  83.          _root.playeralive = false;
  84.          _root.die_init();
  85.          _root.player.gotoAndStop("die");
  86.          this.enemy.gotoAndPlay("att");
  87.       }
  88.    }
  89.    if(this.getroffen == true)
  90.    {
  91.       this.energy -= _root.durchschlag;
  92.       if(this.energy < 0.5)
  93.       {
  94.          var die_ra = random(2) + 1;
  95.          _root.actives -= 1;
  96.          this.alive = "false";
  97.          _root.bodycount += 1;
  98.          _root.score_txt += 100;
  99.          this.enemy.gotoAndPlay("die" + die_ra);
  100.          this.alive = "deathsceneplayed";
  101.          _root.win_level(_root.Level);
  102.       }
  103.       else
  104.       {
  105.          if(xwalkspeed > 2)
  106.          {
  107.             xwalkspeed -= 1;
  108.          }
  109.          _root.score_txt += 50;
  110.          this.enemy.gotoAndPlay("inj");
  111.          if(diffx > 0)
  112.          {
  113.             this._x += 20;
  114.          }
  115.          else if(diffx < 0)
  116.          {
  117.             this._x -= 20;
  118.          }
  119.       }
  120.    }
  121. }
  122.